package com.wanxi.interfa;

public class USBTest {

    public static void main(String[] args) {
        Computer computer = new Computer();

        //第一种
        USB phone = new Phone();


        //第二种
        computer.transferData(new Phone());


        USB usb = new USB() {//第三种
            @Override
            public void start() {
                System.out.println("打印机开始");
            }

            @Override
            public void end() {
                System.out.println("打印机结束");
            }
        };
        computer.transferData(usb);




        computer.transferData(new USB() {//第四种
            @Override
            public void start() {
                System.out.println("相机开始");
            }

            @Override
            public void end() {
                System.out.println("相机结束");
            }
        });







    }
}
